<template>
    <van-nav-bar title="我的关注" left-arrow @click-left="onClickLeft" />

    <van-empty description="一个都没有" v-if="num == 0" />

    <div v-for="(item, index) in zzitem" :key="index" @click="djzzxx(item)">
        <div class="parent-box">
            <div class="left-box">
                <img :src="item?.web_url" alt="">
            </div>
            <div class="middle-box">
                <div>{{ item.user_name }}</div>
                <div>{{ item.desc }}</div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import { useRouter } from 'vue-router';

const router = useRouter()
const zzitem = ref()
const num = ref(0)
// 作者详细
const djzzxx = (item) => {
    localStorage.setItem('zuozheitem', JSON.stringify(item))
    router.push('/zuozhexx')
}

const onClickLeft = () => history.back();

onMounted(() => {
    zzitem.value = JSON.parse(localStorage.getItem('zzitemlist'))
    num.value = zzitem.value.length
})
</script>

<style lang="less" scoped>
.tpdbzwc {
    box-sizing: border-box;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;

    .xjitem {
        box-sizing: border-box;
        width: 50%;
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 10px;

        img {
            width: 170px;
            height: 200px;
            object-fit: cover;
            border-radius: 10px 10px 0 0;
        }

        .tpdbxm {
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
            border-radius: 0 0 10px 10px;
            box-sizing: border-box;
            padding: 10px;
            width: 100%;
            // height: 50px;
            // background-color: red;

            .tpdbwz {
                box-sizing: border-box;
                font-size: 14px;
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 2;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .tpdbwz2,
            .tpdbwz3 {
                color: #bdbdbd;
                font-size: 12px;
                box-sizing: border-box;
                padding-top: 5px;
            }

            .tpdbwz2 {
                padding-top: 20px;
            }
        }
    }

    .xjitem:nth-child(odd) {
        padding-right: 7px;
    }

    .xjitem:nth-child(even) {
        padding-left: 7px;
    }


}



.container {
    box-sizing: border-box;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 10px;
}

.image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 10px;
}

.text-container {
    box-sizing: border-box;
    padding-left: 10px;
    padding-right: 10px;
    width: calc(100% - 50px);
    height: 50px;
}

.text-top {
    height: 50%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    display: flex;
}

.text-bottom {
    width: 100%;
    height: 50%;
    color: #bebebe;
    font-size: 12px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 25px;
}

.zwm {
    box-sizing: border-box;
    padding: 10px;

    .mglz {
        width: 100%;
        border-radius: 10px;
        box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);

        .imgwb {
            border-radius: 10px 10px 0 0;
            position: relative;
            height: 150px;
            width: 100%;
            display: flex;
            /* 设置容器为 flex 容器 */
            align-items: center;
            /* 垂直居中 */
            justify-content: center;
            /* 水平居中 */
            overflow: hidden;

            /* 隐藏超出容器范围的部分 */
            img {
                object-fit: cover;
                /* 按照容器宽高比例进行裁剪，尽可能覆盖整个容器 */
                width: 100%;
                /* 设置图片宽度为 100%，占满容器 */
                height: 100%;
                /* 设置图片高度为 100%，占满容器 */
            }

            .top-left-text {
                position: absolute;
                top: 10px;
                /* 距离顶部10px */
                left: 10px;
                /* 距离左边10px */
                font-size: 12px;
                /* 字体大小为12px */
                color: white;
            }

            .bottom-left-text {
                position: absolute;
                bottom: 10px;
                /* 距离底部10px */
                left: 10px;
                /* 距离左边10px */
                font-size: 12px;
                /* 字体大小为14px */
                color: white;
            }
        }
    }

    .xmtext {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 50px;
        width: 100%;
        border-radius: 0 0 10px 10px;
        position: relative;


        .top-text {
            left: 10px;
            width: calc(100% - 10px);
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
            display: flex;
            align-items: center;
        }

        .top-text {
            font-size: 14px;
        }


    }
}

.dbxzdj {
    width: 100%;
    height: 40px;
    background-color: #fbfbfb;
    text-align: center;
    line-height: 40px;
}

.zzc {
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, .7);
    position: absolute;
    z-index: 99999;

    img {
        width: 100%;
    }
}

.dtimgdt {
    height: 170px !important;
}

.hdcktext {
    font-size: 12px;
    height: 100px;
    width: 100%;
    color: #bdbdbd;
    background-color: #fcfcfc;
    text-align: center;
    line-height: 100px;
}

.dtimgwm {
    position: relative;
}

.dtimg {
    position: absolute;
    width: 25px;
    height: 25px;
    border-radius: 100%;
    bottom: 0;
    left: 10px;
}

.dtlmtext {
    position: absolute;
    font-size: 14px;
    color: #a8a8a8;
    bottom: 0;
    left: 45px;
}

.ydwm {
    box-sizing: border-box;
    padding: 10px;
}

.yd {
    width: 100%;
    height: 20px;
    color: #b1b1b1;
    font-size: 12px;
    text-align: center;
    margin: 20px 0;
}

.yd2 {
    font-weight: 600;

}

.yd3 {
    color: #b1b1b1;
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 20px;
}

.dytext {
    font-size: 14px;
    color: #818181;
    margin-bottom: 20px;
}

.yd4 {
    width: 100%;
    border-radius: 10px;
}

.gdt {
    height: 10px;
    background-color: #f7f7f7;
    width: 100%;
}

.gdt2 {
    height: 5px;
}

.ybicon {
    display: flex;
    justify-content: space-evenly;
}

.dataitem {
    margin-bottom: 20px;
}

.dataitem:nth-child(even) {
    display: flex;
    justify-content: flex-end;
}

.image-box {
    border: 1px solid #ccc;
    /* 设置边框 */
    display: inline-block;

    /* 将盒子设置为行内块元素，以便于其他元素与之并排显示 */
    img {
        width: 153px;
        height: 88px;
    }
}

.date {
    padding: 10px 0;
    text-align: center;
    /* 将日期居中显示 */
}

// 淡入淡出动画
.fade-enter-active,
.fade-leave-active {
    transition: opacity .5s;
}

.fade-enter,
.fade-leave-to {
    opacity: 0;
}

.zpwz {
    box-shadow: 0px 1px 5px 1px #d4d4d4;
    border-radius: 10px;
    box-sizing: border-box;
    margin: 10px;

    img {
        width: 100%;
        border-radius: 10px 10px 0 0;
        margin-bottom: 20px;
    }
}

.jz {
    text-align: center;
    padding-bottom: 30px;
}

.flip {
    transform: rotateZ(180deg);
}

.top {
    box-sizing: border-box;
    padding: 5px;
}

.ybwzwm {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;


}

.ybwz {
    font-size: 12px;
    color: rgb(201, 201, 201);
}

.lzb {
    display: flex;
    align-items: flex-end;
}

.lt {
    font-weight: 600;
    margin-right: 5px;
    display: flex;
}

.rt {
    font-size: 12px;
    display: flex;
}

.parent-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    padding: 10px;
}

.left-box {
    width: 50px;
    height: 50px;
    overflow: hidden;
    position: relative;

    img {
        /* 需要设置相对定位 */
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        position: absolute;
        /* 需要设置绝对定位 */
        top: 0;
        left: 0;
        border-radius: 100%;
    }
}

.right-box {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;

    .ybgz {
        font-size: 12px;
        border: 1px solid black;
        border-radius: 20px;
        width: 50px;
        height: 20px;
        text-align: center;
        line-height: 20px;
    }
}

.middle-box {
    flex: 1;
    height: 50px;
    display: flex;
    flex-direction: column;
    width: 0;

    // overflow: hidden;
    div {
        flex: 1;
        display: flex;
        align-items: center;
        box-sizing: border-box;
        padding-left: 10px;
    }

    div:nth-child(1) {
        font-size: 14px;
    }

    div:nth-child(2) {
        font-size: 12px;
        color: #c2c2c2;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        margin-right: 5px;
    }
}

.sstbwz {
    position: absolute;
    right: 0;
    top: 0;
    width: 50px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}
</style>